<?php
/**
 * Create by 11li
 * Date 2020/3/11
 * Time 9:49
 *
 */

namespace app\common\service;


use app\common\model\Feedback;
use think\Exception;

class FeedbackService extends BaseService
{
	public function __construct()
	{
		$this->model = new Feedback();
	}
	
	
	/**
	 * 添加反馈内容
	 * @param $userId
	 * @param $content
	 * @return false|int
	 * @throws Exception
	 */
	public function addFeedback($userId, $content)
	{
		if(!$userId || !$content) {
			throw new Exception('参数错误');
		}
		
		return $this->model->allowField(true)
			->isUpdate(false)
			->save([
				'user_id' => $userId,
				'content' => $content
			]);
	}
}